
package com.dps.omc.service.impl;
import com.dps.omc.service.IAgentNodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dps.common.service.impl.AbstractPageService;
import com.dps.omc.dao.IDbServerDAO;
import com.dps.omc.model.DbServer;
import com.dps.omc.service.IDbServerService;

import java.util.List;

@SuppressWarnings("unchecked")
@Service("DbServerServiceImpl")

public class DbServerServiceImpl extends AbstractPageService<IDbServerDAO,DbServer> implements IDbServerService {

	@Autowired
	private IDbServerDAO dbServerDAO;
	@Autowired
	private IAgentNodeService agentNodeService;
	@Override
	public boolean getEnableDataPerm() {
		// TODO Auto-generated method stub
		return false;
	}
	@Override
	public IDbServerDAO getDao() {
		return dbServerDAO;
	}

	@Override
	public List<DbServer> findUnbind() {
		return getDao().findUnbind();
	}

	@Override
	public void unbind(String id) {
		getDao().unbind(id);
	}

	@Override
	public void deleteByIds(String ids) {

		String[] idArr = ids.split(",");
		for(String id:idArr)
		{
			getDao().deleteById(id);
			agentNodeService.deleteByProperty("nodeId",id);
		}

	}
}
